@import "../../style/mixins/index";

.antCheckboxFn(@checkbox-prefix-cls: ant-checkbox) {
  @checkbox-inner-prefix-cls: ~"@{checkbox-prefix-cls}-inner";
  // 一般状态
  .@{checkbox-prefix-cls} {
    white-space: nowrap;
    cursor: pointer;
    outline: none;
    display: inline-block;
    line-height: 1;
    position: relative;
    vertical-align: middle;

    &:hover,
    &-focused {
      .@{checkbox-inner-prefix-cls} {
        border-color: #bcbcbc;
      }
    }

    &-inner {
      display: inline-block;
      width: 14px;
      height: 14px;
      background-repeat: no-repeat;
      background-size: cover;
      background-image: url('/cloudstore/resource/pc/com/images/checkbox_normal.png');
    }

    &-input {
      position: absolute;
      left: 0;
      z-index: 1;
      cursor: pointer;
      .opacity(0);
      top: 0;
      bottom: 0;
      right: 0;
      width: 100%;
      height: 100%;
    }
  }

  // 半选状态
  .@{checkbox-prefix-cls}-indeterminate {
    .@{checkbox-inner-prefix-cls} {
      background-image: url('/cloudstore/resource/pc/com/images/checkbox_indeterminate.png');
    }
  }

  // 选中状态
  .@{checkbox-prefix-cls}-checked {

    // &:hover {
    //   .@{checkbox-inner-prefix-cls} {
    //     border-color: @primary-color;
    //   }
    // }

    .@{checkbox-inner-prefix-cls} {
      background-image: url('/cloudstore/resource/pc/com/images/checkbox_checked.png');
    }
  }

  .@{checkbox-prefix-cls}-disabled {
    &.@{checkbox-prefix-cls}-checked {
      .@{checkbox-inner-prefix-cls} {
        background-image: url('/cloudstore/resource/pc/com/images/checkbox_disable_checked_.png');
      }
    }

    .@{checkbox-inner-prefix-cls} {
      background-image: url('/cloudstore/resource/pc/com/images/checkbox_disable.png');
    }

    .@{checkbox-inner-prefix-cls}-input {
      cursor: default;
    }

    & + span {
      color: #ccc;
      cursor: @cursor-disabled;
    }
  }

  .@{checkbox-prefix-cls}-wrapper {
    cursor: pointer;
    font-size: @font-size-base;
    display: inline-block;
    & + & {
      margin-left: 8px;
    }
  }

  .@{checkbox-prefix-cls}-wrapper + span,
  .@{checkbox-prefix-cls} + span {
    margin-left: 8px;
    margin-right: 8px;
  }

  .@{checkbox-prefix-cls}-group {
    font-size: @font-size-base;
    &-item {
      display: inline-block;
    }
  }

  @ie8: \0screen;

  // IE8 hack for https://github.com/ant-design/ant-design/issues/2148
  @media @ie8 {
    .@{checkbox-prefix-cls}-checked .@{checkbox-prefix-cls}-inner:before,
    .@{checkbox-prefix-cls}-checked .@{checkbox-prefix-cls}-inner:after {
      .iconfont-font("\e62e");
      font-weight: bold;
      font-size: 8px;
      border: 0;
      color: #fff;
      left: 2px;
      top: 3px;
      position: absolute;
    }
  }
}
